<!DOCTYPE html>
<html lang="en">
	<head>
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
		<meta charset="utf-8" />
		<title>油田生产智能自动化系统</title>

		<meta name="description" content="User login page" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />

		<!-- bootstrap & fontawesome -->
		<link rel="stylesheet" href="../assets/css/bootstrap.css" />
		<link rel="stylesheet" href="../assets/css/font-awesome.css" />

		<!-- text fonts -->
		<link rel="stylesheet" href="../assets/css/ace-fonts.css" />

		<!-- ace styles -->
		<link rel="stylesheet" href="../assets/css/ace.css" />
		<link rel="stylesheet" href="../css/login.css"/>

		<!--[if lte IE 9]>
			<link rel="stylesheet" href="../assets/css/ace-part2.css" />
		<![endif]-->
		<link rel="stylesheet" href="../assets/css/ace-rtl.css" />

		<!--[if lte IE 9]>
		  <link rel="stylesheet" href="../assets/css/ace-ie.css" />
		<![endif]-->

		<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->

		<!--[if lt IE 9]>
		<script src="../assets/js/html5shiv.js"></script>
		<script src="../assets/js/respond.js"></script>
		<![endif]-->
	</head>

	<body class="bg-login login-layout ">
	<img style="position:fixed" src="../img/bg_login.jpg" height="100%" width="100%"/>
		<div class="main-container">
			<div class="main-content">
				<div class="row">
					<div class="col-sm-10 col-sm-offset-1">
						<div class="login-container">
							<div class="center">
								<h2>
									<i class="ace-icon fa fa-leaf green"></i>
									<span class="white">油井在线监测管理平台</span>
								</h2>
								<h4 class="blue" id="id-company-text">
								<p class="white" >陕西瀚林中信石油工程设备有限公司</p>
								<p class="white" >北京中科院软件中心有限公司</p></h4>
							</div>

							<div class="space-6"></div>

							<div class="position-relative">
								<div id="login-box" class="login-box visible widget-box no-border">
									<div class="widget-body">
										<div class="widget-main">
											<h4 class="header blue lighter bigger">
												<i class="ace-icon fa fa-coffee green"></i>
												用户登录
											</h4>

											<div class="space-6"></div>

											<!-- 注意：此处如果写成/login会出现后台不能获取到表单数据，发生了重定向 -->
									<form action="/formLogin/" method="post">
												<fieldset>
													<label class="block clearfix">
														<span class="block input-icon input-icon-right">
															<input name="user.username" id="username" autocomplete="off" type="text" class="form-control" placeholder="请输入用户名"  />
															<i class="ace-icon fa fa-user"></i>
														</span>
														<div class="form-alert alert-no-user " ></div>
														<div  class="form-alert">${userError!}</div>
													</label>

													<label class="block clearfix">
														<span class="block input-icon input-icon-right">
															<input name="user.passwd"  id="password" type="password" autocomplete="off" class="form-control" placeholder="请输入密码" />
															<i class="ace-icon fa fa-lock"></i>
														</span>
														<div class="form-alert alert-no-password "></div>
														<div class="form-alert">${passwordError!}</div>
													</label>

													<div class="space"></div>

													<div class="clearfix">
														<label class="inline">
															<input id="remember" name="remember" type="checkbox" class="ace"/>
															<span class="lbl"> 记住密码</span>
														</label>
			
														<input type="submit" id="btn_sub" class="width-35 pull-right btn btn-sm btn-primary" value="登录" />
													</div>

													<div class="space-4"></div>
												</fieldset>
											</form>

										</div><!-- /.widget-main -->

										<div class="toolbar clearfix">
											<div>
												<a href="#" data-target="#forgot-box" class="forgot-password-link">
													<i class="ace-icon fa fa-arrow-left"></i>
													忘记密码？
												</a>
											</div>


										</div>
									</div><!-- /.widget-body -->
								</div><!-- /.login-box -->

								<div id="forgot-box" class="forgot-box widget-box no-border">
									<div class="widget-body">
										<div class="widget-main">
											<h4 class="header red lighter bigger">
												<i class="ace-icon fa fa-key"></i>
												找回密码
											</h4>

											<div class="space-6"></div>
											<p>
												输入邮箱地址接收验证码
											</p>

											<form>
												<fieldset>
													<label class="block clearfix">
														<span class="block input-icon input-icon-right">
															<input type="email" class="form-control" placeholder="Email" />
															<i class="ace-icon fa fa-envelope"></i>
														</span>
													</label>

													<div class="clearfix">
														<button type="button" class="width-35 pull-right btn btn-sm btn-danger">
															<i class="ace-icon fa fa-lightbulb-o"></i>
															<span class="bigger-110">发送</span>
														</button>
													</div>
												</fieldset>
											</form>
										</div><!-- /.widget-main -->

										<div class="toolbar center">
											<a href="#" data-target="#login-box" class="back-to-login-link">
												返回登录
												<i class="ace-icon fa fa-arrow-right"></i>
											</a>
										</div>
									</div><!-- /.widget-body -->
								</div><!-- /.forgot-box -->

								<div id="signup-box" class="signup-box widget-box no-border">
									<div class="widget-body">
										<div class="widget-main">
											<h4 class="header green lighter bigger">
												<i class="ace-icon fa fa-users blue"></i>
												注册新用户
											</h4>

											<div class="space-6"></div>
											<p> 请填写以下信息: </p>

											<form>
												<fieldset>
													<label class="block clearfix">
														<span class="block input-icon input-icon-right">
															<input type="email" class="form-control" placeholder="邮箱" />
															<i class="ace-icon fa fa-envelope"></i>
														</span>
													</label>

													<label class="block clearfix">
														<span class="block input-icon input-icon-right">
															<input type="text" class="form-control" placeholder="用户名" />
															<i class="ace-icon fa fa-user"></i>
														</span>
													</label>

													<label class="block clearfix">
														<span class="block input-icon input-icon-right">
															<input type="password" class="form-control" placeholder="密码" />
															<i class="ace-icon fa fa-lock"></i>
														</span>
													</label>

													<label class="block clearfix">
														<span class="block input-icon input-icon-right">
															<input type="password" class="form-control" placeholder="重复密码" />
															<i class="ace-icon fa fa-retweet"></i>
														</span>
													</label>

													<label class="block">
														<input type="checkbox" class="ace" />
														<span class="lbl">
															我接受
															<a href="#">用户条款</a>
														</span>
													</label>

													<div class="space-24"></div>

													<div class="clearfix">
														<button type="reset" class="width-30 pull-left btn btn-sm">
															<i class="ace-icon fa fa-refresh"></i>
															<span class="bigger-110">重置</span>
														</button>

														<button type="button" class="width-65 pull-right btn btn-sm btn-success">
															<span class="bigger-110">注册</span>

															<i class="ace-icon fa fa-arrow-right icon-on-right"></i>
														</button>
													</div>
												</fieldset>
											</form>
										</div>

										<div class="toolbar center">
											<a href="#" data-target="#login-box" class="back-to-login-link">
												<i class="ace-icon fa fa-arrow-left"></i>
												返回登录
											</a>
										</div>
									</div><!-- /.widget-body -->
								</div><!-- /.signup-box -->
							</div><!-- /.position-relative -->


						</div>
					</div><!-- /.col -->
				</div><!-- /.row -->
			</div><!-- /.main-content -->
		</div><!-- /.main-container -->

		<!-- basic scripts -->

		<!--[if !IE]> -->
		<script type="text/javascript">
			window.jQuery || document.write("<script src='../assets/js/jquery.js'>"+"<"+"/script>");
		</script>

		<!-- <![endif]-->

		<!--[if IE]>
<script type="text/javascript">
 window.jQuery || document.write("<script src='../assets/js/jquery1x.js'>"+"<"+"/script>");
</script>
<![endif]-->
		<script type="text/javascript">
			if('ontouchstart' in document.documentElement) document.write("<script src='../assets/js/jquery.mobile.custom.js'>"+"<"+"/script>");
		</script>
        <script type="text/javascript" src="../assets/js/jquery.cookie.js"></script>
		<!-- inline scripts related to this page -->
		<script type="text/javascript">
			jQuery(function($) {
			 $(document).on('click', '.toolbar a[data-target]', function(e) {
				e.preventDefault();
				var target = $(this).data('target');
				$('.widget-box.visible').removeClass('visible');//hide others
				$(target).addClass('visible');//show target
			 });
			});
			
			//you don't need this, just used for changing background
			jQuery(function($) {
			 var COOKIE_NAME="rmName";//这里的名字和后台的名字一致
			 var COOKIE_PWD="rmPassword";
			 var i_name=$('#username');
			 var i_pwd=$('#password');
			    
			 i_name.val( getCookieByName(COOKIE_NAME));
  			 i_pwd.val( getCookieByName(COOKIE_PWD) );
   
			 $('#btn-login-dark').on('click', function(e) {
				$('body').attr('class', 'login-layout');
				$('#id-text2').attr('class', 'white');
				$('#id-company-text').attr('class', 'blue');
				
				e.preventDefault();
			 });
			 $('#btn-login-light').on('click', function(e) {
				$('body').attr('class', 'login-layout light-login');
				$('#id-text2').attr('class', 'grey');
				$('#id-company-text').attr('class', 'blue');
				
				e.preventDefault();
			 });
			 $('#btn-login-blur').on('click', function(e) {
				$('body').attr('class', 'login-layout blur-login');
				$('#id-text2').attr('class', 'white');
				$('#id-company-text').attr('class', 'light-blue');
				
				e.preventDefault();
			 });
			 	 //进行表单校验,防止为空
			 $('#btn_sub').on('click',function(e) {
			     var c_alert_user=$('.alert-no-user');
			     var c_alert_pwd=$('.alert-no-password');
			     if(i_name.val()==''){
			        if(c_alert_user.text()==""){c_alert_user.append("用户名不能为空")};//防止重复append
			        i_name.focus();
			        e.preventDefault();//禁止提交表单
			   	 }else if(i_pwd.val()==''){
			      i_pwd.focus();
			      if(c_alert_pwd.text()==""){c_alert_pwd.append("密码不能为空")};
			      e.preventDefault();//禁止提交表单
			     }else{
			   //        if($("#remember").is(':checked')){
			   //            saveToCookie(i_name.val(),i_pwd.val(),10);
			    //        }else{

			    //           delCookieByName(COOKIE_NAME);
			    //           delCookieByName(COOKIE_PWD);
			    //        }
			            c_alert_user.empty();
			            c_alert_pwd.empty();
			   }
			 });
			  //cookie的逻辑操作
			 function getCookieByName(name){
			   return $.cookie(name)!=null?$.cookie(name):null;
			 }
	
			  //此处没用
			 function saveToCookie(username,pwd,data){
			   if(username!="" && pwd!=""){
			    $.cookie(COOKIE_NAME,username,{path:'/',expires:data});
                $.cookie(COOKIE_PWD,pwd,{path:'/',expires:data});
			   }
			    
			 } 
			 //未用，在后台实现
			 function delCookieByName(name){
			    $.cookie(name,null,{path:'/',expires:-1});
			 }
			 
			});
		</script>
	</body>
</html>
